<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTypesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_types', function (Blueprint $table) {
            //商品分类
            $table->bigIncrements('id');
            $table->unsignedBigInteger('seller_id')->comment('商家id');
            $table->unsignedBigInteger('parent_id')->default(0)->comment('父id');
            $table->string('name',255)->comment('分类名称');
            $table->boolean('is_parent')->default(0)->comment('是否为父菜单 1-是0-否');
            $table->boolean('status')->nullable(false)->default(true)->comment('状态1-启用0-禁用');
            $table->unsignedInteger('sort')->default(1)->comment('排序倒序');
            $table->timestamps();
            $table->foreign('seller_id')->references('id')->on('sellers')->onDelete('cascade')->onUpdate('cascade');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_types');
    }
}
